dialog: Expose the content area as a separate GtkBox child
authorTimm Bäder <mail@baedert.org>
Wed, 26 Dec 2018 08:00:08 +0000 (09:00 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 24 Jan 2019 00:30:46 +0000 (19:30 -0500)
This way, the "vbox" internal child does not contain anything by
default. It previously did contain "internal" widgetry like the action
area.

12 files changed:
demos/widget-factory/widget-factory.ui
gtk/gtkdialog.c
gtk/ui/gtkaboutdialog.ui
gtk/ui/gtkappchooserdialog.ui
gtk/ui/gtkcolorchooserdialog.ui
gtk/ui/gtkdialog.ui
gtk/ui/gtkfilechooserdialog.ui
gtk/ui/gtkfontchooserdialog.ui
gtk/ui/gtkmessagedialog.ui
gtk/ui/gtkpagesetupunixdialog.ui
gtk/ui/gtkprintunixdialog.ui
testsuite/gtk/builder.c

index d1ad3ffaff30eb84074930f444e9bb66bf1ba400..4363d5a954709b4ee022131383885182d66a9fac 100644 (file)
@@ -3283,7 +3283,7 @@ bad things might happen.</property>
     <property name="use-header-bar">1</property>
     <property name="title" translatable="yes">Zelda</property>
     <property name="hide-on-close">1</property>
-    <child internal-child="vbox">
+    <child internal-child="content_area">
       <object class="GtkBox">
         <child>
           <object class="GtkLabel">
@@ -3322,7 +3322,7 @@ bad things might happen.</property>
     <property name="use-header-bar">1</property>
     <property name="title" translatable="yes">Settings</property>
     <property name="hide-on-close">1</property>
-    <child internal-child="vbox">
+    <child internal-child="content_area">
       <object class="GtkBox">
         <child>
           <object class="GtkGrid">
@@ -3443,7 +3443,7 @@ bad things might happen.</property>
     <property name="use-header-bar">1</property>
     <property name="title" translatable="yes">Choose one</property>
     <property name="hide-on-close">1</property>
-    <child internal-child="vbox">
+    <child internal-child="content_area">
       <object class="GtkBox">
         <child>
           <object class="GtkFlowBox" id="selection_flowbox">
index 756446aaa840ebf091d67f7d5241f388c38f8464..3604c592c9b869c26a842082af42e2ae678eb244 100644 (file)
  * # GtkDialog as GtkBuildable
  *
  * The GtkDialog implementation of the #GtkBuildable interface exposes the
- * @vbox and @action_area as internal children with the names “vbox” and
- * “action_area”.
+ * @message_area and @action_area as internal children with the names
+ * “action_area” and “action_area”.
  *
  * GtkDialog supports a custom <action-widgets> element, which can contain
  * multiple <action-widget> elements. The “response” attribute specifies a
 
 typedef struct
 {
-  GtkWidget *vbox;
   GtkWidget *headerbar;
   GtkWidget *action_area;
+  GtkWidget *content_area;
   GtkWidget *action_box;
   GtkSizeGroup *size_group;
 
@@ -592,9 +592,9 @@ gtk_dialog_class_init (GtkDialogClass *class)
   /* Bind class to template
    */
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/ui/gtkdialog.ui");
-  gtk_widget_class_bind_template_child_internal_private (widget_class, GtkDialog, vbox);
   gtk_widget_class_bind_template_child_internal_private (widget_class, GtkDialog, headerbar);
   gtk_widget_class_bind_template_child_internal_private (widget_class, GtkDialog, action_area);
+  gtk_widget_class_bind_template_child_internal_private (widget_class, GtkDialog, content_area);
   gtk_widget_class_bind_template_child_private (widget_class, GtkDialog, action_box);
 
   gtk_widget_class_set_css_name (widget_class, I_("dialog"));
@@ -727,7 +727,7 @@ gtk_dialog_close (GtkDialog *dialog)
  * Creates a new dialog box.
  *
  * Widgets should not be packed into this #GtkWindow
- * directly, but into the @vbox and @action_area, as described above.
+ * directly, but into the @content_area and @action_area, as described above.
  *
  * Returns: the new dialog as a #GtkWidget
  */
@@ -1621,5 +1621,5 @@ gtk_dialog_get_content_area (GtkDialog *dialog)
 
   g_return_val_if_fail (GTK_IS_DIALOG (dialog), NULL);
 
-  return priv->vbox;
+  return priv->content_area;
 }
index f698c758b9a2fde8435bd999456f6b46966c483d..10d42987d216e7d064355777c3d4156620d2664f 100644 (file)
@@ -15,8 +15,8 @@
         </child>
       </object>
     </child>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox1">
+    <child internal-child="content_area">
+      <object class="GtkBox">
         <property name="orientation">vertical</property>
         <property name="spacing">2</property>
         <property name="margin">5</property>
index 9c09d757c7e5795269782e8d6f140ed6dd449673..27a0a6211492367c54d6b53ba52d6e44dbba5745 100644 (file)
@@ -4,7 +4,7 @@
   <template class="GtkAppChooserDialog" parent="GtkDialog">
     <property name="title" translatable="yes">Select Application</property>
     <property name="type-hint">dialog</property>
-    <child internal-child="vbox">
+    <child internal-child="content_area">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="orientation">vertical</property>
         <property name="spacing">2</property>
index 347fc6f99fb2cb813ceb3bdf6f1a3d4ed2ba7a0c..814222f912c2081ca56411457f438bfe7ae07557 100644 (file)
@@ -5,7 +5,7 @@
     <property name="title" translatable="yes">Select a Color</property>
     <property name="type-hint">dialog</property>
     <property name="resizable">0</property>
-    <child internal-child="vbox">
+    <child internal-child="content_area">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="orientation">vertical</property>
         <property name="spacing">2</property>
index d2d2638947b2e1d01ee9a3425cc1daa1f69a9e01..1bd869b6c5afbe320f382150cba1a6185651f2cd 100644 (file)
       </object>
     </child>
     <child>
-      <object class="GtkBox" id="vbox">
+      <object class="GtkBox">
         <property name="orientation">vertical</property>
         <style>
           <class name="dialog-vbox"/>
         </style>
+
+        <!-- This is empty here and just exists so we can expose it as
+             GtkDialog API. -->
+        <child>
+          <object class="GtkBox" id="content_area">
+          </object>
+        </child>
+
         <child>
           <object class="GtkBox" id="action_box">
             <style>
index 1b37a4ce0e834ba831459f804c0408bcf266efb4..fac32bca111e0cc9fc1783cc378de081777e7c3f 100644 (file)
@@ -6,8 +6,8 @@
     <property name="type-hint">dialog</property>
     <property name="default-width">600</property>
     <signal name="response" handler="response_cb" swapped="no"/>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox1">
+    <child internal-child="content_area">
+      <object class="GtkBox">
         <property name="orientation">vertical</property>
         <child internal-child="action_area">
           <object class="GtkButtonBox" id="dialog-action_area1">
index e6fb4ec3a67d616d67ca27af57bf2aaabbc4b7f2..cb244a94a01042a48951565662e906222b883e03 100644 (file)
@@ -4,7 +4,7 @@
   <template class="GtkFontChooserDialog" parent="GtkDialog">
     <property name="title" translatable="yes">Select Font</property>
     <property name="type-hint">dialog</property>
-    <child internal-child="vbox">
+    <child internal-child="content_area">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="orientation">vertical</property>
         <property name="spacing">2</property>
index 35834d9d48b094f192dce9a2d2986c0615dabae6..7b4588fb80f79613ac9dcdeee0e2e3acd131ad60 100644 (file)
@@ -9,7 +9,7 @@
     <child internal-child="headerbar">
       <object class="GtkHeaderBar" id="headerbar1"/>
     </child>
-    <child internal-child="vbox">
+    <child internal-child="content_area">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="orientation">vertical</property>
         <property name="spacing">20</property>
index 4b0b948f0c521925846cbf3a2eb3db8ef49be930..4e94af14dbebf3af44ff8bc695529ce201bcf016 100644 (file)
@@ -27,7 +27,7 @@
     <property name="resizable">0</property>
     <property name="type-hint">dialog</property>
     <property name="title" translatable="yes">Page Setup</property>
-    <child internal-child="vbox">
+    <child internal-child="content_area">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="orientation">vertical</property>
         <property name="spacing">2</property>
index 056877c5c0ad12c21ffc6dcd9f436d4d419d37a7..71ffe20151c2962c1a8c00c97f78aa7c697fdca1 100644 (file)
@@ -51,7 +51,7 @@
     <property name="type-hint">dialog</property>
     <signal name="notify::page-setup" handler="redraw_page_layout_preview" swapped="no"/>
     <signal name="response" handler="error_dialogs" swapped="no"/>
-    <child internal-child="vbox">
+    <child internal-child="content_area">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="orientation">vertical</property>
         <property name="spacing">2</property>
index 6d320bf4545b016be154f40b6bb0a93dad3f2f87..d47f91e5fc735da5546871c0191ea40fbf9fabc7 100644 (file)
@@ -918,7 +918,7 @@ test_children (void)
     "<interface>"
     "  <object class=\"GtkDialog\" id=\"dialog1\">"
     "    <property name=\"use_header_bar\">1</property>"
-    "    <child internal-child=\"vbox\">"
+    "    <child internal-child=\"content_area\">"
     "      <object class=\"GtkBox\" id=\"dialog1-vbox\">"
     "        <property name=\"orientation\">vertical</property>"
     "          <child internal-child=\"action_area\">"
@@ -961,7 +961,6 @@ test_children (void)
   g_assert (vbox != NULL);
   g_assert (GTK_IS_BOX (vbox));
   g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (vbox)) == GTK_ORIENTATION_VERTICAL);
-  g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (gtk_widget_get_parent (GTK_WIDGET (vbox)))), "dialog1") == 0);
   g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (content_area)), "dialog1-vbox") == 0);
 
   action_area = gtk_builder_get_object (builder, "dialog1-action_area");
@@ -1334,7 +1333,7 @@ test_dialog (void)
   const gchar buffer1[] =
     "<interface>"
     "  <object class=\"GtkDialog\" id=\"dialog1\">"
-    "    <child internal-child=\"vbox\">"
+    "    <child internal-child=\"content_area\">"
     "      <object class=\"GtkBox\" id=\"dialog1-vbox\">"
     "        <property name=\"orientation\">vertical</property>"
     "          <child internal-child=\"action_area\">"